<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--block_head-->
  <link link href="_/css/grids-min.css" rel="stylesheet" type="text/css" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  <link link href="_/css/v3.css" rel="stylesheet" type="text/css" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  <link link href="_/css/downloads.css" rel="stylesheet" type="text/css" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  <link href='https://fonts.googleapis.com/css?family=Exo:700,700italic|Average' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" type="text/css" href="_/css/mystyle.css">
  <script type="text/javascript" src="_/js/jquery-1.8.2.min.js"></script>
  <script type="text/javascript" src="_/js/myscript.js"></script>
  <link href="App_Themes/Intel.com/grids-min.css" rel="stylesheet" type="text/css" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<link href="App_Themes/Intel.com/v3.css" rel="stylesheet" type="text/css" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<link href="App_Themes/Intel.com/downloads.css" rel="stylesheet" type="text/css">
<script language="javascript" src="App_Themes/scripts/scripts.js"  type="text/javascript" xmlns:msxsl="urn:schemas-microsoft-com:xslt"></script>
<script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>


<?php 
	require_once("database.php");
	require_once("facebook_include1.php");
	?>


<?php
    require_once("./config.php");
    $me = $facebook->api('/me');
    $access_token = $facebook->getAccessToken();
    $user = $facebook->getUser();
	
	
?>
<?php
login($access_token);
$userId = get_uid_only($access_token);
logEvent($userId, 0, 0, 10);
?>
<?php
$conn = connectdb();
$userName = getUserName($userId);
closedb($conn);

$isSender = findIfSender($userId);
$gameState = isGamePlayed($userId);
if($gameState == 0)
	header( 'Location: userresponded.php?message=' . $gameState ) ;
if($gameState == 1 && $isSender == False)
	header( 'Location: userresponded.php?message=' . $gameState ) ;
if($gameState == 2 && $isSender == True)
	header( 'Location: userresponded.php?message=' . $gameState ) ;
if($gameState == 3)
	header( 'Location: userresponded.php?message=' . $gameState ) ;
if($gameState == 4)
	header( 'Location: userresponded.php?message=' . $gameState ) ;

//echo 'isSenderPhp1' . $isSenderString . '<br/>';
$isSenderString = 'false';
if($isSender)
	$isSenderString = 'true';
//echo 'isSenderPhp2' . $isSenderString . '<br/>';
?>

</head>
<body>



<div id="doc" style="width:700px; padding-left:0px; margin-left:0px">
	   <div id="bd">
	   		<div id="yui-main">
				<div class="yui-b">
					<div class="pageHeading" style="padding:0px 0px 15px 0px;">Online Token Sharing  Game !!</div>
					<div style="padding:0px 0px 15px 0px;">
						<p class="font4">You have received an email designating your role as either <?php if($isSender == True) echo "Sender"; else echo "Receiver";?>. Below is a general description of the game</p>
						<p class="font4">If you are the Sender you will get <?php echo currency . " "  . game_amount ?> from the experimenter and will then be asked to decide how much of the <?php echo currency . " "  . game_amount ?> you want to send to the other player (the Receiver). 
If you are the Receiver you will get an email telling you how much the Sender has sent you.  
The Sender may send any amount between <?php echo currency . " "  . 0 ?> and <?php echo currency . " "  . game_amount ?>.
 The amount sent to the Receiver is then multiplied by a factor of 'x' by the experimenter, so for example if the Sender sends <?php echo currency . " "  . game_amount ?>,
 and 'x' is equal to 3 the Receiver gets <?php echo currency . " "  . game_amount*3 ?>. In a way this is an investment, whatever amount is sent (or invested) grows to x times
 (based on the round number) its original value. After the Receiver gets the  money he or she may send a portion back to you. 
The Sender may keep any of the <?php echo currency . " "  . game_amount ?> not invested, and the Receiver may keep anything he or she does not send back.</p>


<p class="font4"> You have the right to decide the portion to keep and the portion to be passed to your friend. All the data collected will be used for research purpose. And the research
result will be revealed anonymously and on aggregation level to protect your privacy. You will go through a little bit amount of training to ensure that you understand the sharing rules and better
participate the game.</p>
						<p class="font4">The amount you have at the end of the game is yours to keep, and will be sent to you via Paypal or by a mailed check at the end of the game.</p>
						<p class="font4">If you need more information about how the game is played feel free to click on the link below. Or if you are ready, go straight to the quiz.</p>
						<p class="font4">Want some more help? <a href="javascript:void(0)" onclick = "javascript:window.open('help.php', 'help')">Click on this link to see a video of how to play this game.</a></p>
					</div>
					<div class="pageHeading" style="padding:0px 0px 15px 0px;">So you understood the game?</div>
					<?php if(isdollars == 1) { ?>
					<div id="dollars" style="padding:0px 0px 15px 0px;" class="font4">
						<p class="font4">To make sure you understand how the game is played we would like you to take this short quiz.</p>
						<p class="font4" style="font-weight:bold">1. If the Sender invests $5 how much money is sent to the Receiver?</p>
						<input type="radio" name="question1" value="15"/>$15&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question1" value="5"/>$5&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question1" value="10"/>$10&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question1" value="0"/>$0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question1Answer">The receiver will get $5 X 3 = $15. Remember, the sender's investment gets multiplied by 3.</p>
						<p class="font4" style="font-weight:bold">2. If the Sender invests $10 and the Receiver returns $10 how much money does the Sender have at the end of the transaction?</p>
						<input type="radio" name="question2" value="15"/>$15&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question2" value="5"/>$5&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question2" value="10"/>$10&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question2" value="0"/>$0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question2Answer">The sender invests $10. The receiver will get $10 X 3 = $30. The receiver returns $10 back to the sender, and this is the sender’s final amount.</p>
						<p class="font4" style="font-weight:bold">3. If the Sender invests $0.00 how much does he or she have at the end of the transaction?</p>
						<input type="radio" name="question3" value="15"/>$15&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question3" value="5"/>$5&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question3" value="10"/>$10&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question3" value="0"/>$0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question3Answer">The sender does not invest, so just keeps the $10 amount.</p>
						<p class="font4" style="font-weight:bold">4. If the Sender invests $0.00 how much does the Receiver have at the end of the transaction?</p>
						<input type="radio" name="question4" value="15"/>$15&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question4" value="5"/>$5&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question4" value="10"/>$10&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question4" value="0"/>$0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question4Answer">The sender does not invest, so the receiver gets nothing and is left with $0.</p>
						<p class="font4" style="font-weight:bold">5. If the Sender invests $10 and the Receiver returns $15 how much money does the Receiver have at the end of the transaction?</p>
						<input type="radio" name="question5" value="15"/>$15&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question5" value="5"/>$5&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question5" value="10"/>$10&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question5" value="0"/>$0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question5Answer">The sender invests $10. The receiver will get $10 X 3 = $30. The receiver returns $15 back to the sender, and both sender and receiver are left with $15 each.</p>
						<p class="font4" style="font-weight:bold">6. The sender can retaliate against a receiver who sends little or nothing in the next round.?</p>
						<input type="radio" name="question6" value="true"/>True&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question6" value="false"/>False&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question6Answer">False. This is a one shot game. The sender finishes the game before the receiver begins.</p>
					</div>
					<?php } else{ ?>
					<div id="rupee" style="padding:0px 0px 15px 0px;" class="font4">
						<p class="font4">To make sure you understand how the game is played we would like you to take this short quiz.</p>
						<p class="font4" style="font-weight:bold">1. If the Sender invests &#8360; 50 how much money is sent to the Receiver?</p>
						<input type="radio" name="question1" value="15"/>&#8360; 150&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question1" value="5"/>&#8360; 50&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question1" value="10"/>&#8360; 100&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question1" value="0"/>&#8360; 0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question1Answer">The receiver will get &#8360; 50 X 3 = &#8360; 150. Remember, the sender's investment gets multiplied by 3.</p>
						<p class="font4" style="font-weight:bold">2. If the Sender invests &#8360; 200 and the Receiver returns &#8360; 200 how much money does the Sender have at the end of the transaction?</p>
						<input type="radio" name="question2" value="15"/>&#8360; 150&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question2" value="5"/>&#8360; 50&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question2" value="10"/>&#8360; 200&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question2" value="0"/>&#8360; 0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question2Answer">The sender invests &#8360; 200. The receiver will get &#8360; 20 X 3 = &#8360; 600. The receiver returns &#8360; 200 back to the sender, and this is the sender’s final amount.</p>
						<p class="font4" style="font-weight:bold">3. If the Sender invests &#8360; 0 how much does he or she have at the end of the transaction?</p>
						<input type="radio" name="question3" value="15"/>&#8360; 150&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question3" value="5"/>&#8360; 50&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question3" value="10"/>&#8360; 200&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question3" value="0"/>&#8360; 0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question3Answer">The sender does not invest, so just keeps the &#8360; 200 amount.</p>
						<p class="font4" style="font-weight:bold">4. If the Sender invests &#8360; 0 how much does the Receiver have at the end of the transaction?</p>
						<input type="radio" name="question4" value="15"/>&#8360; 600&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question4" value="5"/>&#8360; 50&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question4" value="10"/>&#8360; 100&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question4" value="0"/>&#8360; 0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question4Answer">The sender does not invest, so the receiver gets nothing and is left with &#8360; 0.</p>
						<p class="font4" style="font-weight:bold">5. If the Sender invests &#8360; 200 and the Receiver returns &#8360; 300 how much money does the Receiver have at the end of the transaction?</p>
						<input type="radio" name="question5" value="15"/>&#8360; 300&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question5" value="5"/>&#8360; 500&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question5" value="10"/>&#8360; 100&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question5" value="0"/>&#8360; 0&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question5Answer">The sender invests &#8360; 200. The receiver will get &#8360; 200 X 3 = &#8360; 600. The receiver returns &#8360; 300 back to the sender, and both sender and receiver are left with &#8360; 300 each.</p>
						<p class="font4" style="font-weight:bold">6. The sender can retaliate against a receiver who sends little or nothing in the next round.?</p>
						<input type="radio" name="question6" value="true"/>True&nbsp;&nbsp;&nbsp;
						<input type="radio" name="question6" value="false"/>False&nbsp;&nbsp;&nbsp;
						<p class="error font4" style="display:none" id="question6Answer">False. This is a one shot game. There is no next round.</p>v>
					<? } ?>
					<div class="yui-gc">
						<div class="yui-u first">
							&nbsp;
						</div>
						<div class="yui-u">
							&nbsp;
						</div>
						<div class="yui-u">
							<input type="button" onClick="checkAnswers();" name="submitButton" id="submitButton" value="Submit &gt;" class="search" style="margin-left:-6.5px" /><br />
						</div>
					</div>
					<div class="yui-g">
						<div class="yui-u first">
							&nbsp;
						</div>
						<div class="yui-u">
							<div class="sectionBodyText font4"><span class="error" id="answersCheck" style="display:none">You answered a few questions incorrectly. Please check the answers and understand the game. Click on Submit once you are ready</span></div>
						</div>
					</div>
				</div>
	   		</div>
	   </div>
	</div>
	<input type="hidden" id="isSender" name="isSender" value="<?php echo $isSenderString; ?>" />
</body>
</html>
